package com.nageoffer.shortlink.admin.controller;

import com.nageoffer.shortlink.common.convention.result.Result;
import com.nageoffer.shortlink.remote.ShortLinkClient;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequiredArgsConstructor
public class UrlTitleController {
    private final ShortLinkClient shortLinkClient;
    @GetMapping("api/short-link/admin/title")
    public Result<String> getTitleByUrl(@RequestParam("url")String url) throws IOException {
       return shortLinkClient.getTitleByUrl(url);
    }
}
